package mns

import (
	"encoding/json"
)

type ExchangeParams struct {
	Func   string                 `json:"func"`
	Params map[string]interface{} `json:"params"`
}

// Publish message with exchange queue
func PublishMessageWithExchange(queueName string, funcName string, params map[string]interface{}) error {
	data, err := json.Marshal(&ExchangeParams{
		Func:   funcName,
		Params: params,
	})
	if err != nil {
		return err
	}
	return Publish(queueName, data, 0, 8)
}
